var __extends =
    (this && this.__extends) ||
    (function () {
      var e = function (i, n) {
        return (e =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (e, i) {
              e.__proto__ = i;
            }) ||
          function (e, i) {
            for (var n in i)
              Object.prototype.hasOwnProperty.call(i, n) && (e[n] = i[n]);
          })(i, n);
      };
      return function (i, n) {
        function t() {
          this.constructor = i;
        }
        if ("function" != typeof n && null !== n)
          throw new TypeError(
            "Class extends value " + String(n) + " is not a constructor or null"
          );
        e(i, n),
          (i.prototype =
            null === n
              ? Object.create(n)
              : ((t.prototype = n.prototype), new t()));
      };
    })(),
  AXHunDanDetailsDialog = (function (e) {
    function i() {
      var i = e.call(this) || this;
      return (
        WebSocketService.addListener({
          caller: i,
          code: 6184,
          method: i.onLoadHundanMessageData,
        }),
        WebSocketService.addListener({
          caller: i,
          code: 6186,
          method: i.onLoadHundanActionData,
        }),
        WebSocketService.addListener({
          caller: i,
          code: 6189,
          method: i.onLoadHundanXiShouListData,
        }),
        WebSocketService.addListener({
          caller: i,
          code: 6185,
          method: i.onLoadHundanXiShouData,
        }),
        i.btn_hundan_jihuo.on(Laya.Event.CLICK, i, i.onDidHunDanJiHuoAction),
        i.btn_hundan_xishou.on(Laya.Event.CLICK, i, i.onDidHunDanJiHuoAction),
        i.btn_hundan_shengji.on(Laya.Event.CLICK, i, i.onDidHunDanJiHuoAction),
        (i.list_hundan_xishou.vScrollBarSkin = ""),
        i.list_hundan_xishou.on(Laya.Event.CLICK, i, i.onDidClickListFn),
        i
      );
    }
    return (
      __extends(i, e),
      (i.showHunDanDialog = function (e, n) {
        return (
          null == this.hundanV &&
            ((this.hundanV = new i()), (this.hundanV.zOrder = 1e3)),
          this.hundanV.popup(),
          (this.hundanV.btn_hundan_jihuo.visible = !1),
          (this.hundanV.jsonObj = e),
          (this.hundanV.label_hunshi_empty.visible = !1),
          (this.hundanV.comeInView = ""),
          "HunDanWearDialog" == n
            ? ((this.hundanV.image_hundan_item1.visible = !1),
              (this.hundanV.image_hundan_item2.visible = !0),
              WebSocketService.send({ c: 6189, d: { id: e.id, pageNum: 0 } }),
              (this.hundanV.label_wear_mainTitle.text = e.lvl + " 级" + e.name))
            : ((this.hundanV.image_hundan_item1.visible = !0),
              (this.hundanV.image_hundan_item2.visible = !1),
              (this.hundanV.label_wear_mainTitle.text = e.lvl + " 级" + e.name),
              WebSocketService.send({ c: 6184, d: { id: e.id, cid: 0 } })),
          (this.hundanV.comeInView = n),
          this.hundanV
        );
      }),
      (i.prototype.onLoadHundanMessageData = function (e) {
        0 == e.code &&
          ((this.label_hundan_zhiye.text = Utils.transform(
            e.data.t,
            "roleType"
          )),
          1 == e.data.ss
            ? ((this.label_hundan_zhuangtai.text = "已激活"),
              (this.btn_hundan_jihuo.visible = !1))
            : ((this.label_hundan_zhuangtai.text = "归元"),
              (this.btn_hundan_jihuo.visible = !0)),
          (this.label_hundan_xiaoguo.text = e.data.descr),
          (this.label_hundan_hunzhi.text = e.data.e + "/" + e.data.eUp),
          (this.label_hundan_shengji.text = e.data.silver + "银"),
          (this.label_wear_mainTitle.text = e.data.lvl + "级" + e.data.name));
      }),
      (i.prototype.onLoadHundanActionData = function (e) {
        if (0 == e.code) {
          var n = !1;
          if (
            (Laya.stage._childs.forEach(function (e) {
              e == i && (n = !0);
            }),
            0 == n)
          )
            return void (
              "AXWearableGoodView" == this.comeInView &&
              WebSocketService.send({
                c: 6184,
                d: { id: this.jsonObj.id, cid: 0 },
              })
            );
          "HunDanWearDialog" == this.comeInView
            ? (WebSocketService.send({
                c: 6189,
                d: { id: this.jsonObj.id, pageNum: 0 },
              }),
              this.jsonObj.cid
                ? WebSocketService.send({
                    c: 6184,
                    d: { id: this.jsonObj.id, cid: this.jsonObj.cid },
                  })
                : WebSocketService.send({
                    c: 6184,
                    d: { id: this.jsonObj.id, cid: 0 },
                  }))
            : "AXSuboardinateDetailView" == this.comeInView
            ? WebSocketService.send({
                c: 6184,
                d: { id: this.jsonObj.id, cid: 0 },
              })
            : "AXWearableGoodView" == this.comeInView &&
              WebSocketService.send({
                c: 6184,
                d: { id: this.jsonObj.id, cid: 0 },
              });
        }
        ToastView.toastView(e.msg);
      }),
      (i.prototype.onLoadHundanXiShouListData = function (e) {
        if (0 == e.code) {
          (this.image_hundan_item1.visible = !1),
            (this.image_hundan_item2.visible = !0),
            (this.arrList = []);
          var i = void 0;
          e.list.length > 0
            ? (this.label_hunshi_empty.visible = !1)
            : (this.label_hunshi_empty.visible = !0);
          for (var n = 0; n < e.list.length; n++) {
            var t = e.list[n];
            (i = {
              label_xishou_name: {
                text: t.lvl + "级" + t.name + "(" + t.energy + "魂元)",
              },
              energy: t.energy,
              id: t.id,
            }),
              this.arrList.push(i);
          }
          this.list_hundan_xishou.dataSource = this.arrList;
        }
      }),
      (i.prototype.onLoadHundanXiShouData = function (e) {
        0 == e.code
          ? (e.msg
              ? ToastView.toastView(e.msg)
              : ToastView.toastView("成功吸收"),
            WebSocketService.send({ c: 6035, d: { pageNum: 0 } }),
            WebSocketService.send({
              c: 6189,
              d: { id: this.jsonObj.id, pageNum: 0 },
            }),
            "HunDanWearDialog" == this.comeInView
              ? this.jsonObj.cid
                ? WebSocketService.send({
                    c: 6184,
                    d: { id: this.jsonObj.id, cid: this.jsonObj.cid },
                  })
                : WebSocketService.send({
                    c: 6184,
                    d: { id: this.jsonObj.id, cid: 0 },
                  })
              : WebSocketService.send({
                  c: 6184,
                  d: { id: this.jsonObj.id, cid: this.jsonObj.cid },
                }))
          : ToastView.toastView(e.msg);
      }),
      (i.prototype.onDidClickListFn = function (e) {
        if ("" != e.target.name && "btn_canXiShou" == e.target.name) {
          var i = this.list_hundan_xishou.selectedItem;
          (this.hunNum = i.energy),
            WebSocketService.send({
              c: 6185,
              d: { id: this.jsonObj.id, xid: i.id },
            });
        }
      }),
      (i.prototype.onDidHunDanJiHuoAction = function (e) {
        "item_jihuo" == e.target.name
          ? WebSocketService.send({
              c: 6186,
              d: { id: this.jsonObj.id, act: 3 },
            })
          : "item_xishou" == e.target.name
          ? WebSocketService.send({
              c: 6189,
              d: { id: this.jsonObj.id, pageNum: 0 },
            })
          : "item_shengji" == e.target.name &&
            WebSocketService.send({
              c: 6186,
              d: { id: this.jsonObj.id, act: 5 },
            });
      }),
      i
    );
  })(ui.TabBarItemController.AXHunDanDetailsDialogUI);
